package spring6_learn.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;

import java.sql.SQLOutput;

public class User implements BeanNameAware, BeanFactoryAware, BeanClassLoaderAware , InitializingBean ,DisposableBean{
    private String name;
    public User(){
        System.out.println("第一步实例化Bean");
    }

    public void setName(String name) {
        System.out.println("第二步给属性赋值");
        this.name = name;
    }

    public void initBean(){
        System.out.println("第三步初始化Bean");
    }
    public void destroyBean(){
        System.out.println("第五步y销毁Bean");
    }

    @Override
    public void setBeanClassLoader(ClassLoader classLoader) {
        System.out.println("类加载器"+classLoader);
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("beanFactory"+beanFactory);

    }

    @Override
    public void setBeanName(String name) {
        System.out.println("beanName"+name);

    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("initializingBean");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("DisposableBean");
    }
}
